#include <stdio.h>

#define IN   1   /* inside a word */
#define OUT  0   /* outside a word */
#define LEN 10   /* word lengths */
#define V   20   /* maximum vertical size of histogram */

/* prints a vertical word length histogram of the input */
main(){
    int i, j, c, K, state;
    long wl[LEN];
    
    /* wl[0] stores count of words at least 10 letters long,
       as there are no 0-length words */

    state = OUT;
    
    for(i=0; i<LEN; ++i)
        wl[i]=0;
    
    while ((c = getchar()) != EOF) {
        if (c == ' ' || c == '\n' || c == '\t'){
            if(state == IN){
                if(i<LEN)
                    ++wl[i];
                else
                    ++wl[0];
            }    
            state = OUT;
        }
        else if(state == OUT) {
            state = IN;
            i=1;
        }
        else if(state == IN)
            ++i;
    }
    
    for(i=0; i<V; ++i){
        putchar('|');
        for(j=0; j<LEN; ++j){
            if(wl[j]>=V-i)
                printf("***|");
            else
                printf("   |");
        }
        putchar('\n');
    }
    
    printf(">10");
    
    for(i=1; i<LEN; ++i)
        printf("%4d", i);
    putchar('\n');
}
